Global Functions Class
Methods
addChild
-
expression
Adds a child DisplayObject instance to the Stage.
Parameters:
-
expression
ObjectThe DisplayObject instance that you pass in the child parameter.
Example:
var backLayer = LSprite();
addChild(backLayer);
getTimer
()
Float
public
Returns the number of milliseconds that have elapsed since Engine initialization.
Returns:
The number of milliseconds that have elapsed since Engine initialization.
LExtends
-
child
-
parent
-
params
Object Inheritance.Equivalent to base.
Parameters:
-
child
LDisplayObjectThe child。
-
parent
ObjectThe parent。
-
params
Arrayparams。
Example:
LInit(50, "legend", 800, 480, main);
function FatherClass(){
this.name = "Father";
}
FatherClass.prototype.getName = function(){
return this.name;
};
function ChildClass(){
LExtends(this,FatherClass,[]);
this.name = "Child";
}
function main () {
LGlobal.setDebug(true);
var father = new FatherClass();
var child = new ChildClass();
trace("father.getName() = " + father.getName()); //father.getName() = Father
trace("child.getName() = " + child.getName());//child.getName() = Child
}
LInit
-
speed
-
divid
-
width
-
height
-
callback
-
type
Engine initialization. Equivalent to init.
Parameters:
-
speed
Floatgame speed(milliseconds), FPS = 1000 / speed.
-
divid
StringSpecifies a unique id for a div tag.
-
width
IntGame Interface's width.
-
height
IntGame Interface's height.
-
callback
FunctionEngine initialization's callback method.
-
type
StringIf your init function call is after the onload, then you need to set this parameter to LEvent.INIT.
Example:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>demo</title>
</head>
<body>
<div id="mylegend">loading……</div>
<script type="text/javascript" src="../lufylegend-x.x.x.min.js"></script>
<script>
LInit(50,"mylegend",800,480,main);
//window.onload = function(){LInit(50, "mylegend", 800, 480, main, LEvent.INIT);};
function main(){
alert("Hello lufylegend!");
}
</script>
</body>
</html>
removeChild
-
expression
Removes the specified child DisplayObject instance from the child list of the Stage instance.
Parameters:
-
expression
ObjectThe DisplayObject instance to remove.
Example:
var backLayer = LSprite();
addChild(backLayer);
removeChild(backLayer);
trace
-
expression
You can use Debug Mode to capture output from the trace() function and display the result. If any argument in a trace statement includes a data type other than a String, the trace function invokes the associated toString() method for that data type. For example, if the argument is a Boolean value the trace function invokes Boolean.toString() and displays the return value.
Parameters:
-
expression
ObjectAn expression to evaluate. the value of the expression parameter is displayed in the Output panel.
Example:
trace("debug text 1", "debug text 2", "debug text 3");